package avortep;

import java.util.HashMap;

public class DBWeakParent extends DBChild {
	
	protected HashMap<String, DBChild> children;
	
	public DBWeakParent(String name) {
		super(name);
		this.setParent(null);
		children = new HashMap<String, DBChild>();
	}
	
	public HashMap<String, DBChild> getChildren() {
		return children;
	}


	
	protected void addChild(DBChild child) {
		if (child!=null)
			children.put(child.getName().trim().toUpperCase(), child);
	}	
	public boolean hasChildName(String name) {		
		return children.containsKey(name.trim().toUpperCase());
	}
	
	public DBChild getChildByName(String name) {
		if (children.containsKey(name.trim().toUpperCase()))
			return (DBChild) children.get(name.trim().toUpperCase());
		return null;
	}

	public int countChildren() {
		return children.size();
	}

	public boolean hasChild(DBChild child) {
		return children.containsValue(child);
	}

}
